#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

int divide(int dividend, int divisor) {
    int isNeg = 1;
    int ans = 0;
    long long a = dividend, b = divisor;
    if (a < 0) {
        isNeg *= -1;
        a = -a;
    }
    if (divisor < 0)  {
        isNeg *= -1;
        b = -b; 
    }
    
   int k = 1;
   while (a >= (b << k)) {
       k++;     
   }

   for (int i = k; i >= 0; i--){ 
       if (a >= (b << i)) {
           a -= b << i;
           ans |= 1 << i;
       }
   }

    return isNeg*ans;
}

int main(int argc, char **argv)
{

    cout << "-----------------Test 1--------------------" << endl;
    cout << divide(100, 3) << endl;


    cout << "-----------------Test 2--------------------" << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
